/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package ec.edu.espe.distribuidas.aseguradora.modelo;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Size;

/**
 *
 * @author pacodell
 */
@Entity
@Table(name = "factura", catalog = "distribuidasjsf", schema = "")
@NamedQueries({
    @NamedQuery(name = "Factura.findAll", query = "SELECT f FROM Factura f")})
public class Factura implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "NUM_FACTURA_SIN2")
    private Integer numFacturaSin2;
    @Size(max = 250)
    @Column(name = "NOM_CLIENTE")
    private String nomCliente;
    @Column(name = "FECHA_EMISION")
    @Temporal(TemporalType.DATE)
    private Date fechaEmision;
    @Lob
    @Size(max = 65535)
    @Column(name = "CONDICIONES_FAC")
    private String condicionesFac;
    @Column(name = "TOTAL")
    private Long total;
    @JoinColumn(name = "COD_FORMA_PAGO", referencedColumnName = "COD_FORMA_PAGO")
    @ManyToOne
    private FormaPago codFormaPago;
    @JoinColumn(name = "COD_CLIENTE", referencedColumnName = "COD_CLIENTE")
    @ManyToOne
    private Cliente codCliente;
    @OneToMany(mappedBy = "numFacturaSin2")
    private List<DetalleFactura> detalleFacturaList;

    public Factura() {
    }

    public Factura(Integer numFacturaSin2) {
        this.numFacturaSin2 = numFacturaSin2;
    }

    public Integer getNumFacturaSin2() {
        return numFacturaSin2;
    }

    public void setNumFacturaSin2(Integer numFacturaSin2) {
        this.numFacturaSin2 = numFacturaSin2;
    }

    public String getNomCliente() {
        return nomCliente;
    }

    public void setNomCliente(String nomCliente) {
        this.nomCliente = nomCliente;
    }

    public Date getFechaEmision() {
        return fechaEmision;
    }

    public void setFechaEmision(Date fechaEmision) {
        this.fechaEmision = fechaEmision;
    }

    public String getCondicionesFac() {
        return condicionesFac;
    }

    public void setCondicionesFac(String condicionesFac) {
        this.condicionesFac = condicionesFac;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }

    public FormaPago getCodFormaPago() {
        return codFormaPago;
    }

    public void setCodFormaPago(FormaPago codFormaPago) {
        this.codFormaPago = codFormaPago;
    }

    public Cliente getCodCliente() {
        return codCliente;
    }

    public void setCodCliente(Cliente codCliente) {
        this.codCliente = codCliente;
    }

    public List<DetalleFactura> getDetalleFacturaList() {
        return detalleFacturaList;
    }

    public void setDetalleFacturaList(List<DetalleFactura> detalleFacturaList) {
        this.detalleFacturaList = detalleFacturaList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (numFacturaSin2 != null ? numFacturaSin2.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Factura)) {
            return false;
        }
        Factura other = (Factura) object;
        if ((this.numFacturaSin2 == null && other.numFacturaSin2 != null) || (this.numFacturaSin2 != null && !this.numFacturaSin2.equals(other.numFacturaSin2))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ec.edu.espe.distribuidas.aseguradora.modelo.Factura[ numFacturaSin2=" + numFacturaSin2 + " ]";
    }
    
}
